home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / pooyan.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  13KB  |  369 lines

  1. /***************************************************************************
  2.  
  3. Notes:
  4. - Several people claim that colors are wrong, but the way the color PROMs
  5.   are used seems correct.
  6.  
  7.  
  8. Pooyan memory map (preliminary)
  9.  
  10. driver by Allard Van Der Bas
  11.  
  12. Thanks must go to Mike Cuddy for providing information on this one.
  13.  
  14. Sound processor memory map.
  15. 0x3000-0x33ff RAM.
  16. AY-8910 #1 : reg 0x5000
  17.          wr  0x4000
  18.              rd  0x4000
  19.  
  20. AY-8910 #2 : reg 0x7000
  21.          wr  0x6000
  22.              rd  0x6000
  23.  
  24. Main processor memory map.
  25. 0000-7fff ROM
  26. 8000-83ff color RAM
  27. 8400-87ff video RAM
  28. 8800-8fff RAM
  29. 9000-97ff sprite RAM (only areas 0x9010 and 0x9410 are used).
  30.  
  31. memory mapped ports:
  32.  
  33. read:
  34. 0xA000    Dipswitch 2 adddbtll
  35.         a = attract mode
  36.         ddd = difficulty 0=easy, 7=hardest.
  37.         b = bonus setting (easy/hard)
  38.         t = table / upright
  39.         ll = lives: 11=3, 10=4, 01=5, 00=255.
  40.  
  41. 0xA0E0  llllrrrr
  42.         l == left coin mech, r = right coinmech.
  43.  
  44. 0xA080    IN0 Port
  45. 0xA0A0    IN1 Port
  46. 0xA0C0    IN2 Port
  47.  
  48. write:
  49. 0xA100    command for the audio CPU.
  50. 0xA180    NMI enable. (0xA180 == 1 = deliver NMI to CPU).
  51.  
  52. 0xA181    interrupt trigger on audio CPU.
  53.  
  54. 0xA183    maybe reset sound cpu?
  55.  
  56. 0xA184    ????
  57.  
  58. 0xA187    Flip screen
  59.  
  60. interrupts:
  61. standard NMI at 0x66
  62.  
  63. ***************************************************************************/
  64.  
  65. #include "driver.h"
  66. #include "vidhrdw/generic.h"
  67.  
  68.  
  69. WRITE_HANDLER( pooyan_flipscreen_w );
  70. void pooyan_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  71. void pooyan_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  72.  
  73. /* defined in sndhrdw/timeplt.c */
  74. extern struct MemoryReadAddress timeplt_sound_readmem[];
  75. extern struct MemoryWriteAddress timeplt_sound_writemem[];
  76. extern struct AY8910interface timeplt_ay8910_interface;
  77. WRITE_HANDLER( timeplt_sh_irqtrigger_w );
  78.  
  79.  
  80. static struct MemoryReadAddress readmem[] =
  81. {
  82.     { 0x0000, 0x7fff, MRA_ROM },
  83.     { 0x8000, 0x8fff, MRA_RAM },    /* color and video RAM */
  84.     { 0xa000, 0xa000, input_port_4_r },    /* DSW2 */
  85.     { 0xa080, 0xa080, input_port_0_r },    /* IN0 */
  86.     { 0xa0a0, 0xa0a0, input_port_1_r },    /* IN1 */
  87.     { 0xa0c0, 0xa0c0, input_port_2_r },    /* IN2 */
  88.     { 0xa0e0, 0xa0e0, input_port_3_r },    /* DSW1 */
  89.     { -1 }    /* end of table */
  90. };
  91.  
  92. static struct MemoryWriteAddress writemem[] =
  93. {
  94.     { 0x0000, 0x7fff, MWA_ROM },
  95.     { 0x8000, 0x83ff, colorram_w, &colorram },
  96.     { 0x8400, 0x87ff, videoram_w, &videoram, &videoram_size },
  97.     { 0x8800, 0x8fff, MWA_RAM },
  98.     { 0x9010, 0x903f, MWA_RAM, &spriteram, &spriteram_size },
  99.     { 0x9410, 0x943f, MWA_RAM, &spriteram_2 },
  100.     { 0xa000, 0xa000, MWA_NOP },    /* watchdog reset? */
  101.     { 0xa100, 0xa100, soundlatch_w },
  102.     { 0xa180, 0xa180, interrupt_enable_w },
  103.     { 0xa181, 0xa181, timeplt_sh_irqtrigger_w },
  104.     { 0xa187, 0xa187, pooyan_flipscreen_w },
  105.     { -1 }    /* end of table */
  106. };
  107.  
  108.  
  109. INPUT_PORTS_START( pooyan )
  110.     PORT_START    /* IN0 */
  111.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  112.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  113.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  114.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  115.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  116.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  117.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  118.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  119.  
  120.     PORT_START    /* IN1 */
  121.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  122.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  123.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
  124.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
  125.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  126.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  127.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  128.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  129.  
  130.     PORT_START    /* IN2 */
  131.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  132.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  133.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
  134.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
  135.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  136.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  137.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  138.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  139.  
  140.     PORT_START    /* DSW0 */
  141.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  142.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  143.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  144.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  145.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  146.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  147.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  148.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  149.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  150.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  151.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  152.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  153.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  154.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  155.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  156.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  157.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  158.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  159.     PORT_DIPSETTING(    0x00, "Attract Mode - No Play" )
  160.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  161.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  162.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  163.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  164.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  165.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  166.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  167.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  168.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  169.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  170.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  171.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  172.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  173.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  174.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  175.  
  176.     PORT_START    /* DSW1 */
  177.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  178.     PORT_DIPSETTING(    0x03, "3" )
  179.     PORT_DIPSETTING(    0x02, "4" )
  180.     PORT_DIPSETTING(    0x01, "5" )
  181.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
  182.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  183.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  184.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  185.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
  186.     PORT_DIPSETTING(    0x08, "50000 80000" )
  187.     PORT_DIPSETTING(    0x00, "30000 70000" )
  188.     PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
  189.     PORT_DIPSETTING(    0x70, "Easiest" )
  190.     PORT_DIPSETTING(    0x60, "Easier" )
  191.     PORT_DIPSETTING(    0x50, "Easy" )
  192.     PORT_DIPSETTING(    0x40, "Normal" )
  193.     PORT_DIPSETTING(    0x30, "Medium" )
  194.     PORT_DIPSETTING(    0x20, "Difficult" )
  195.     PORT_DIPSETTING(    0x10, "Hard" )
  196.     PORT_DIPSETTING(    0x00, "Hardest" )
  197.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  198.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  199.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  200. INPUT_PORTS_END
  201.  
  202.  
  203.  
  204. static struct GfxLayout charlayout =
  205. {
  206.     8,8,    /* 8*8 characters */
  207.     256,    /* 256 characters */
  208.     4,    /* 4 bits per pixel */
  209.     { 0x1000*8+4, 0x1000*8+0, 4, 0 },
  210.     { 0, 1, 2, 3, 8*8+0,8*8+1,8*8+2,8*8+3 },
  211.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  212.     16*8    /* every char takes 16 consecutive bytes */
  213. };
  214. static struct GfxLayout spritelayout =
  215. {
  216.     16,16,    /* 16*16 sprites */
  217.     64,    /* 64 sprites */
  218.     4,    /* 4 bits per pixel */
  219.     { 0x1000*8+4, 0x1000*8+0, 4, 0 },
  220.     { 0, 1, 2, 3,  8*8+0, 8*8+1, 8*8+2, 8*8+3,
  221.             16*8+0, 16*8+1, 16*8+2, 16*8+3,  24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  222.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  223.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  224.     64*8    /* every sprite takes 64 consecutive bytes */
  225. };
  226.  
  227.  
  228.  
  229. static struct GfxDecodeInfo gfxdecodeinfo[] =
  230. {
  231.     { REGION_GFX1, 0, &charlayout,       0, 16 },
  232.     { REGION_GFX2, 0, &spritelayout, 16*16, 16 },
  233.     { -1 } /* end of array */
  234. };
  235.  
  236.  
  237.  
  238. static struct MachineDriver machine_driver_pooyan =
  239. {
  240.     /* basic machine hardware */
  241.     {
  242.         {
  243.             CPU_Z80,
  244.             3072000,    /* 3.072 Mhz (?) */
  245.             readmem,writemem,0,0,
  246.             nmi_interrupt,1
  247.         },
  248.         {
  249.             CPU_Z80 | CPU_AUDIO_CPU,
  250.             14318180/8,    /* 1.789772727 MHz */                        \
  251.             timeplt_sound_readmem,timeplt_sound_writemem,0,0,
  252.             ignore_interrupt,1    /* interrupts are triggered by the main CPU */
  253.         }
  254.     },
  255.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  256.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  257.     0,
  258.  
  259.     /* video hardware */
  260.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  261.     gfxdecodeinfo,
  262.     32,16*16+16*16,
  263.     pooyan_vh_convert_color_prom,
  264.  
  265.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  266.     0,
  267.     generic_vh_start,
  268.     generic_vh_stop,
  269.     pooyan_vh_screenrefresh,
  270.  
  271.     /* sound hardware */
  272.     0,0,0,0,
  273.     {
  274.         {
  275.             SOUND_AY8910,
  276.             &timeplt_ay8910_interface
  277.         }
  278.     }
  279. };
  280.  
  281.  
  282.  
  283. /***************************************************************************
  284.  
  285.   Game driver(s)
  286.  
  287. ***************************************************************************/
  288.  
  289. ROM_START( pooyan )
  290.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  291.     ROM_LOAD( "1.4a",         0x0000, 0x2000, 0xbb319c63 )
  292.     ROM_LOAD( "2.5a",         0x2000, 0x2000, 0xa1463d98 )
  293.     ROM_LOAD( "3.6a",         0x4000, 0x2000, 0xfe1a9e08 )
  294.     ROM_LOAD( "4.7a",         0x6000, 0x2000, 0x9e0f9bcc )
  295.  
  296.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  297.     ROM_LOAD( "xx.7a",        0x0000, 0x1000, 0xfbe2b368 )
  298.     ROM_LOAD( "xx.8a",        0x1000, 0x1000, 0xe1795b3d )
  299.  
  300.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  301.     ROM_LOAD( "8.10g",        0x0000, 0x1000, 0x931b29eb )
  302.     ROM_LOAD( "7.9g",         0x1000, 0x1000, 0xbbe6d6e4 )
  303.  
  304.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  305.     ROM_LOAD( "6.9a",         0x0000, 0x1000, 0xb2d8c121 )
  306.     ROM_LOAD( "5.8a",         0x1000, 0x1000, 0x1097c2b6 )
  307.  
  308.     ROM_REGION( 0x0220, REGION_PROMS )
  309.     ROM_LOAD( "pooyan.pr1",   0x0000, 0x0020, 0xa06a6d0e ) /* palette */
  310.     ROM_LOAD( "pooyan.pr2",   0x0020, 0x0100, 0x82748c0b ) /* sprites */
  311.     ROM_LOAD( "pooyan.pr3",   0x0120, 0x0100, 0x8cd4cd60 ) /* characters */
  312. ROM_END
  313.  
  314. ROM_START( pooyans )
  315.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  316.     ROM_LOAD( "ic22_a4.cpu",  0x0000, 0x2000, 0x916ae7d7 )
  317.     ROM_LOAD( "ic23_a5.cpu",  0x2000, 0x2000, 0x8fe38c61 )
  318.     ROM_LOAD( "ic24_a6.cpu",  0x4000, 0x2000, 0x2660218a )
  319.     ROM_LOAD( "ic25_a7.cpu",  0x6000, 0x2000, 0x3d2a10ad )
  320.  
  321.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  322.     ROM_LOAD( "xx.7a",        0x0000, 0x1000, 0xfbe2b368 )
  323.     ROM_LOAD( "xx.8a",        0x1000, 0x1000, 0xe1795b3d )
  324.  
  325.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  326.     ROM_LOAD( "ic13_g10.cpu", 0x0000, 0x1000, 0x7433aea9 )
  327.     ROM_LOAD( "ic14_g9.cpu",  0x1000, 0x1000, 0x87c1789e )
  328.  
  329.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  330.     ROM_LOAD( "6.9a",         0x0000, 0x1000, 0xb2d8c121 )
  331.     ROM_LOAD( "5.8a",         0x1000, 0x1000, 0x1097c2b6 )
  332.  
  333.     ROM_REGION( 0x0220, REGION_PROMS )
  334.     ROM_LOAD( "pooyan.pr1",   0x0000, 0x0020, 0xa06a6d0e ) /* palette */
  335.     ROM_LOAD( "pooyan.pr2",   0x0020, 0x0100, 0x82748c0b ) /* sprites */
  336.     ROM_LOAD( "pooyan.pr3",   0x0120, 0x0100, 0x8cd4cd60 ) /* characters */
  337. ROM_END
  338.  
  339. ROM_START( pootan )
  340.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  341.     ROM_LOAD( "poo_ic22.bin", 0x0000, 0x2000, 0x41b23a24 )
  342.     ROM_LOAD( "poo_ic23.bin", 0x2000, 0x2000, 0xc9d94661 )
  343.     ROM_LOAD( "3.6a",         0x4000, 0x2000, 0xfe1a9e08 )
  344.     ROM_LOAD( "poo_ic25.bin", 0x6000, 0x2000, 0x8ae459ef )
  345.  
  346.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  347.     ROM_LOAD( "xx.7a",        0x0000, 0x1000, 0xfbe2b368 )
  348.     ROM_LOAD( "xx.8a",        0x1000, 0x1000, 0xe1795b3d )
  349.  
  350.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  351.     ROM_LOAD( "poo_ic13.bin", 0x0000, 0x1000, 0x0be802e4 )
  352.     ROM_LOAD( "poo_ic14.bin", 0x1000, 0x1000, 0xcba29096 )
  353.  
  354.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  355.     ROM_LOAD( "6.9a",         0x0000, 0x1000, 0xb2d8c121 )
  356.     ROM_LOAD( "5.8a",         0x1000, 0x1000, 0x1097c2b6 )
  357.  
  358.     ROM_REGION( 0x0220, REGION_PROMS )
  359.     ROM_LOAD( "pooyan.pr1",   0x0000, 0x0020, 0xa06a6d0e ) /* palette */
  360.     ROM_LOAD( "pooyan.pr2",   0x0020, 0x0100, 0x82748c0b ) /* sprites */
  361.     ROM_LOAD( "pooyan.pr3",   0x0120, 0x0100, 0x8cd4cd60 ) /* characters */
  362. ROM_END
  363.  
  364.  
  365.  
  366. GAME( 1982, pooyan,  0,      pooyan, pooyan, 0, ROT270, "Konami", "Pooyan" )
  367. GAME( 1982, pooyans, pooyan, pooyan, pooyan, 0, ROT270, "[Konami] (Stern license)", "Pooyan (Stern)" )
  368. GAME( 1982, pootan,  pooyan, pooyan, pooyan, 0, ROT270, "bootleg", "Pootan" )
  369.